<h2 class="title">行程点评</h2>

<form class="dianp-pj" action="" method="post" enctype="multipart/form-data">
    <div class="info fix">
        <span class="left">行程名称</span>
        <span class="right"><{$data.title}></span>
    </div>
    <div class="info fix">
        <span class="left">评分</span>
        <span class="txt">行程满意度</span>

        <div class="img fix goods-evaluation">
            <span class="show"></span>
            <span class=""></span>
            <span class=""></span>
            <span class=""></span>
            <span class=""></span>
            <input type="hidden" name="track_score" value="1">
        </div>

        <span class="txt">玩伴满意度</span>

        <div class="img fix goods-evaluation">
            <span class="show"></span>
            <span class=""></span>
            <span class=""></span>
            <span class=""></span>
            <span class=""></span>
            <input type="hidden" name="guider_score" value="1">
        </div>

    </div>

    <label class="label fix">
        <span class="text">评价内容</span>
        <textarea class="textarea" placeholder="0-200字" name="comments"></textarea>
    </label>
    <input type="hidden" name="id" value="<{$data.orderNo}>"/>
    <input type="hidden" name="uid" value="<{$data.uid}>"/>
    <input type="hidden" name="track_id" value="<{$data.goodsId}>"/>
    <input type="hidden" name="track_name" value="<{$data.title}>"/>
    <input type="hidden" name="guider_id" value="<{$data.shopId}>"/>
    <input type="hidden" name="persons" value="<{$data.persons}>"/>
    <div class="imgbox">
        <p class="imgtext">请至少上传一张图片，最多四张图片</p>
        <ul class="box fix">
            <li class="imgli" style="background-size:100% 100%;" id="imgId1"><input name="tourist_pic[]" id="userHeadImg1" type="file" class="file"></li>
            <li class="imgli" style="background-size:100% 100%;" id="imgId2"><input name="tourist_pic[]" id="userHeadImg2" type="file" class="file"></li>
            <li class="imgli" style="background-size:100% 100%;" id="imgId3"><input name="tourist_pic[]" id="userHeadImg3" type="file" class="file"></li>
            <li class="imgli" style="background-size:100% 100%;" id="imgId4"><input name="tourist_pic[]" id="userHeadImg4" type="file" class="file"></li>
        </ul>
    </div>

    <div class="bottom fix">
        <a href="javascript:;" onclick="javascript :history.back(-1);" class="go-back">取消</a>
        <input type="submit"  class="submit" value="发布" onclick="return submit_comment();">
    </div>



</form>
<script>
    $("textarea[name='comments']").change(function(){
    	if($(this).val().length>500)
    		layer.msg("感谢您的热心，但是您输入的评价太长了！");
    });
    $("#userHeadImg1").change(function(event) {
        var file = $(event.target)[0].files[0];
        var src = URL.createObjectURL(file);
        if(file){
            $("#imgId1").css("background-image","url("+src+")")
            //表示获取到了图片
        }else{
            //表示点击了取消
        }
    });
    $("#userHeadImg2").change(function(event) {
        var file = $(event.target)[0].files[0];
        var src = URL.createObjectURL(file);
        if(file){
            $("#imgId2").css("background-image","url("+src+")")
            //表示获取到了图片
        }else{
            //表示点击了取消
        }
    });
    $("#userHeadImg3").change(function(event) {
        var file = $(event.target)[0].files[0];
        var src = URL.createObjectURL(file);
        if(file){
            $("#imgId3").css("background-image","url("+src+")")
            //表示获取到了图片
        }else{
            //表示点击了取消
        }
    });
    $("#userHeadImg4").change(function(event) {
        var file = $(event.target)[0].files[0];
        var src = URL.createObjectURL(file);
        if(file){
            $("#imgId4").css("background-image","url("+src+")")
            //表示获取到了图片
        }else{
            //表示点击了取消
        }
    });

    $(document).ready(function () {
        $('.goods-evaluation').each (function () {
            star_grade(this);
        });
    });

</script>
<script>
    $(".dianping").addClass("active");
    $(".my_common").addClass("mactive");
    $('.down-menu').eq(3).show();
</script>

<script>

function submit_comment() {

    var oComments = $("textarea[name='comments']").val();
    if (!$.trim(oComments)) {
        layer.msg('请输入评价内容');
        return false;
    }
    if(oComments.length>500){
    	layer.msg("感谢您的热心，但是您输入的评价太长了!");
    	return false;
    }

//    var oFile = 1;
//    $("input[name*='tourist_pic']").parent().each(function(){
//        if( $(this).css('backgroundImage').indexOf('up_img4') == -1 ) {
//            oFile = 0;
//        }
//    });
//    if (oFile) {
//        layer.msg('请上传图片');
//        return false;
//    }

}

</script>
